package com.test.ip;

import org.apache.flink.table.functions.AggregateFunction;

import java.util.ArrayList;
import java.util.List;

/**
 * @create: 2023-07-14 00:32
 * --------------
 * @notes:
 **/
public class CollectionList extends AggregateFunction<String[], List<String>> {
    public void retract(List acc,String conlum){
        acc.remove(conlum);
    }

    public void accumulate(List acc,String conlum){
        acc.add(conlum);
    }

    @Override
    public String[] getValue(List list) {
        return (String[]) list.toArray(new String[0]);
    }

    @Override
    public List createAccumulator() {
        List list = new ArrayList<>();
        return list;
    }

    public void resetAccumulator(List list){
        list.clear();
    }
}
